//! \file GuiCEGUI.h
//! \brief TODO: Document
// -----------------------------------------------------------------------------
//! This program is free software; you can redistribute it and/or
//! modify it under the terms of the GNU General Public License
//! as published by the Free Software Foundation; either version 2
//! of the License, or (at your option) any later version.
//!
//! This program is distributed in the hope that it will be useful,
//! but WITHOUT ANY WARRANTY; without even the implied warranty of
//! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//! GNU General Public License for more details.
//!
//! You should have received a copy of the GNU General Public License
//! along with this program; if not, write to the Free Software Foundation,
//! Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// -----------------------------------------------------------------------------
#ifndef dGUI_OPEN_GL_H_
#define dGUI_OPEN_GL_H_

#include "GuiError.h"
#include <SDL/SDL.h>
//#include <GL/gl.h>  TODO: remove
//#include <GL/glu.h>
#include <CEGUI.h>
#include <CEGUI/RendererModules/OpenGL/CEGUIOpenGLRenderer.h>
//#include <CEGUIDefaultResourceProvider.h> TODO: remove?

//#ifdef __cplusplus
//  extern "C" {
//#endif

using namespace CEGUI;

class GuiCEGUI
{
  public:

    // Members

    // Methods
    static GuiCEGUI& getSingleton();
    static GuiCEGUI* getSingletonPtr();
    static tERROR start(void);
    static tERROR stop(tERROR Error);
    static WindowManager *getWm(void);
    static System *getSystem(void);
    static Window *getRoot(void);
    static Font *getFont(void);

    static void inject(void);

    static void render(void);


  private:

    // Singleton
    static GuiCEGUI* m_pGuiCEGUI;           // (Singleton) Instance.
    GuiCEGUI() {};                        // (Singleton) Private so that it can  not be called
    GuiCEGUI(GuiCEGUI const&);              // (Singleton) Don't implement.
    GuiCEGUI& operator=(GuiCEGUI const&);   // (Singleton) Don't implement.

    // Members
    static WindowManager *m_pWm;
    static System *m_pSystem;
    static Window *m_pRoot;
    static Font *m_pFont;

    static double m_PreviousTick;

//    static bool must_quit = false;
//    static double last_time_pulse = 0.001*static_cast<double>(SDL_GetTicks());

//    static SDL_Surface *m_pSurface;

    // Methods
    static tERROR createResourceProvider(void);

    static void injectInput(void);
    static void injectTime(void);

    static void mouseDown(Uint8 Button);
    static void mouseUp(Uint8 Button);

};

//  #ifdef __cplusplus
//    }
//  #endif

#endif // dGUI_OPEN_GL_H_
